package com.kt.uokos.yimo.controller;

import com.kt.uokos.yimo.anno.RequiresPermissionsDesc;
import com.kt.uokos.yimo.anno.validator.Order;
import com.kt.uokos.yimo.anno.validator.Sort;
import com.kt.uokos.yimo.dao.Collect;
import com.kt.uokos.yimo.service.CollectService;
import com.kt.uokos.yimo.util.ResponseUtil;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.authz.annotation.RequiresPermissions;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/admin/collect")

public class AdminCollectController {

    @Resource
    private CollectService collectService;


    @GetMapping("/list")
    public Object list(Integer userId, Integer valueId,
                       @RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer limit,
                       @Sort @RequestParam(defaultValue = "add_time") String sort,
                       @Order @RequestParam(defaultValue = "desc") String order) {
        List<Collect> collectList = collectService.queryAllCollect(userId, valueId, page, limit, sort, order);
        return ResponseUtil.okList(collectList);
    }

}
